package UILayer;
import java.awt.*;
import javax.swing.border.*;
import javax.swing.*;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

//		The SIZE of the MainFrame will be FIXED at a 16:9 ratio... "as seen on (most) TVs"...
//		
//		The height is 768 pixel
//		The width is 
//		


public class MainFrame extends JFrame {

	private JPanel contentPane;

	// // // // //
	// Launch the application.
	// 
	// All of the text in the main(String[] args) method were generated automatically.
	// // // // //
	
	public static void main(String[] args)
	{
		EventQueue.invokeLater(
		new Runnable()
		{
			public void run()
			{
				try
				{
					MainFrame mainFrame = new MainFrame();
					mainFrame.setVisible(true);
				} 
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		}
		);
	}
	
	// Create the MainFrame which will contain the whole visible GUI
	//
	
	public MainFrame() 
	{
		// Name the window.
		//
		super("My Test Program");
		
		// Terminates program when closing window.
		//
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Sets window size.
		//
		setSize(1024, 768);
		
		
		// Centers the window relative to the screen.
		//
		setLocationRelativeTo(null);
		
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		
		setContentPane(contentPane);
		
		
		
		
		
		// Set comfortable background colour
		//
		
		GuiHandler.setBackground(Color.getHSBColor(206, 14, 48));
		
		
		
		
		
		
		// Create north primary Panel
		//
		JPanel northPanelPrimary = new JPanel();
		northPanelPrimary.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		
		contentPane.add(northPanelPrimary, BorderLayout.NORTH);
		
		northPanelPrimary.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
		
//		// Create NORTH secondary Panel
//		//
//		
//		JPanel northPanelSecondary = new JPanel();
//		northPanelSecondary.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
//		
//		contentPane.add(northPanelSecondary, BorderLayout.NORTH);
//		
//		northPanelSecondary.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
		
		// Create NORTH button1
		JButton nBut1 = new JButton("Salg");
		
		nBut1.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				// ... some function
			}
		});
		
		northPanelPrimary.add(nBut1);
		
		// Create button2
		JButton nBut2 = new JButton("Varebeholdning");
		
		nBut2.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				
			}
		});
		
		northPanelPrimary.add(nBut2);
		
		// Create button 3.
		JButton nBut3 = new JButton("Kundekartotek");
		
		nBut3.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				/* What is this now? 
				 * AAh,,, that's the actionListener.. I can use this later U see...
				 * 
				 * Gonna add something I think...
				 * 
				 * */
				
				
				
			}
		});
		
		northPanelPrimary.add(nBut3);
		
//		// Create west panel.
//		//
//		JPanel panelWest = new JPanel();
//		
//		panelWest.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
//		
//		contentPane.add(panelWest, BorderLayout.WEST);
//		
//		panelWest.setLayout(new BoxLayout(panelWest, BoxLayout.Y_AXIS));
		
		// // //
		// 
		// I am not entirely sure we actually need this panel - it distorts more than the customer benefits from it's possibilities.
		// These possible buttons on the West-panel might aswell be incorporated in the "workFrame" - that is, the Eastern panel.
		//
		
		
//		// Create west button 1.
//		//
//		JButton wBut1 = new JButton("Option 1");
//		
//		panelWest.add(wBut1);
//		
//		// Create west button 2.
//		JButton wBut2 = new JButton("Option 2");
//		
//		panelWest.add(wBut2);
//		
//		// Create west button 3.
//		//
//		JButton wBut3 = new JButton("Option 3");
//		
//		panelWest.add(wBut3);
//		
//		// Create west button 4.
//		//
//		JButton wBut4 = new JButton("Option 4");
//		
//		panelWest.add(wBut4);
		
		// Create east panel.
		//
		JPanel panelEast = new JPanel();
		
		contentPane.add(panelEast, BorderLayout.EAST);
		
		panelEast.setLayout(new GridLayout(1, 0, 0, 0));
		
		// Create center panel.
		//
		JPanel panelCenter = new JPanel();
		
		panelCenter.setBorder(new TitledBorder(null, "List of items", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		
		contentPane.add(panelCenter, BorderLayout.CENTER);
		
		panelCenter.setLayout(new BorderLayout(0, 0));
		
		// Create south panel.
		//
		JPanel panelSouth = new JPanel();
		
		panelSouth.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
		
		contentPane.add(panelSouth, BorderLayout.SOUTH);
		
		panelSouth.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		// Create madeBy label.
		//
		JLabel madeBy = new JLabel("UDVIKLER TEAM");
		JLabel developers = new JLabel("/    R.D. Andersen    /    J. Bertelsen    /    T. Franzen    /    J.G. Jensen    /    M.L. Johansen    /");
		panelSouth.add(madeBy);
		
		panelSouth.add(developers);
		
	}

}